package rpcserver

import (
	uuid "github.com/satori/go.uuid"
	"golang.org/x/sync/syncmap"
)

// WifiOnEventList define
var WifiOnEventList = syncmap.Map{}

// WifiOffEventList define
var WifiOffEventList = syncmap.Map{}

// WifiOnEventRegister define
func WifiOnEventRegister(f interface{}) (cb func()) {
	uid := uuid.NewV4()
	WifiOnEventList.Store(uid, f)
	return func() {
		WifiOnEventList.Delete(uid)
	}
}

// WifiOffEventRegister define
func WifiOffEventRegister(f interface{}) (cb func()) {
	uid := uuid.NewV4()
	WifiOffEventList.Store(uid, f)
	return func() {
		WifiOffEventList.Delete(uid)
	}
}
